﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace WMSNet.Core.Infrastructure.Api
{
        public class ApiAuthenticationHandler : DelegatingHandler
        {
            protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
            {
                if (!this.ValidateKey(request))
                    return Task<HttpResponseMessage>.Factory.StartNew((Func<HttpResponseMessage>)(() => new HttpResponseMessage(HttpStatusCode.Forbidden)));
                else
                    return base.SendAsync(request, cancellationToken);
            }

            private bool ValidateKey(HttpRequestMessage message)
            {
                return true;
            }
        }
    
}
